home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / circuits / irsim-ca.2 / irsim-ca / irsim-cap-9.2 / src / other / h2a / h2a.c next >
C/C++ Source or Header  |  1992-04-07  |  3KB  |  130 lines

  1. #include <stdio.h>
  2. #include "defs.h"
  3. #include "net.h"
  4. #include "globals.h"
  5.  
  6.  
  7. public    int    do_delay = FALSE;
  8. public    int    do_rtime = FALSE;
  9. public    int    do_punts = TRUE;
  10. public    int    do_names = FALSE;    /* node name on every line */
  11. public    int    do_sort = FALSE;
  12. public    char    *only_name = NULL;
  13.  
  14.     /* stuff needed by irsim modules (not used by this program) */
  15. public    long    sim_time0 = 0;
  16. public    iptr    o_hinputs, o_linputs, o_uinputs;
  17. public    nptr    cur_node = NULL;
  18. public    long    cur_delta = 0;
  19. public    FILE    *logfile = NULL;
  20. public    int    stack_txtors = 0;
  21. public
  22. #define    compute_trans_state( X )    ( 0 )
  23.  
  24. public    void    NoInit()                {}
  25. public    double    StackCap( t )    tptr  t;        { return 0; }
  26. public    void    free_event( e ) evptr e;        {}
  27. public    void    ClearInputs()                {}
  28. public    void    iinsert( n, list ) nptr n; iptr list;    {}
  29. public    void    init_listTbl()                {}
  30. public    void    make_parallel( n, f ) nptr n; long f;    {}
  31. public    void    pParallelTxtors()            {}
  32. public    void    make_stacks( n ) nptr n;        {}
  33. public    void    pStackedTxtors()            {}
  34.  
  35.  
  36. private    char   *sim_file = NULL;
  37. private    char   *hist_file = NULL;
  38.  
  39.  
  40. main( argc, argv )
  41.   int   argc;
  42.   char  *argv[];
  43.   {
  44.     int   i;
  45.     char  *s;
  46.  
  47.     for( i = 1; i < argc; i++ )
  48.       {
  49.     if( argv[i][0] != '-' )
  50.       {
  51.         hist_file = argv[i];
  52.         if( i + 1 != argc )
  53.         Usage( "Arguments follow hist_file: %s...\n", argv[i+1] );
  54.         break;
  55.       }
  56.     if( argv[i][1] == '\0' )
  57.         Usage( "No switch specified\n", 0 );
  58.  
  59.     for( s = &(argv[i][1]); *s != '\0'; s++ )
  60.       {
  61.         switch( *s )
  62.           {
  63.         case 't' :    do_sort = TRUE;                break;
  64.         case 'n' :    do_names = TRUE;            break;
  65.         case 'P' :    do_punts = FALSE;            break;
  66.         case 'r' :    do_rtime = TRUE;            break;
  67.         case 'd' :    do_delay = TRUE;            break;
  68.         case 'a' :    do_rtime = do_delay = do_punts = TRUE;    break;
  69.         case 's' :
  70.             s = "\0";
  71.             sim_file = argv[++i];
  72.             if( i >= argc )
  73.             Usage( "no filename following '-s'\n", 0 );
  74.             break;
  75.         case 'N' :
  76.             s = "\0";
  77.             only_name = argv[++i];
  78.             if( i >= argc )
  79.             Usage( "no nodename following '-N'\n", 0 );
  80.             break;
  81.         default:
  82.             s[1] = '\0';
  83.             Usage( "Unknown switch: '%s'\n", s );
  84.           }
  85.       }
  86.       }
  87.  
  88.     if( hist_file == NULL )
  89.     Usage( "missing history file\n", 0 );
  90.  
  91.     init_hist();
  92.  
  93.     if( sim_file )
  94.     rd_network( sim_file );
  95.  
  96.     printf( "      time  val" );
  97.     if( do_delay )
  98.     printf( "  delay" );
  99.     if( do_rtime )
  100.     printf( "    r/f" );
  101.     printf( "\n" );
  102.  
  103.     ReadHist( hist_file );
  104.  
  105.     if( do_sort )
  106.     sortAndPrint();
  107.  
  108.     exit( 0 );
  109.   }
  110.  
  111.  
  112. #define    PRINT    (void) fprintf
  113.  
  114. private Usage( s1, s2 )
  115.   char  *s1;
  116.   char  *s2;
  117.   {
  118.     PRINT( stderr, s1, s2 );
  119.     PRINT( stderr, "h2a [-ntPrda] [-s sim_file] [-N node] hist_file\n" );
  120.     PRINT( stderr, "\t-n\t\tprint node name on every line\n" );
  121.     PRINT( stderr, "\t-t\t\tsort entire history by time\n" );
  122.     PRINT( stderr, "\t-P\t\tdo NOT print punted events\n" );
  123.     PRINT( stderr, "\t-r\t\tprint rise/fall times\n" );
  124.     PRINT( stderr, "\t-d\t\tprint delay times\n" );
  125.     PRINT( stderr, "\t-a\t\tprint everything (-r -d and NOT -P)\n" );
  126.     PRINT( stderr, "\t-N node\t\tprint only history for node\n" );
  127.     PRINT( stderr, "\t-s net\tread symbols from net (sim or inet) file\n" );
  128.     exit( 1 );
  129.   }
  130.